fix: redact sensitive values in storage read command#168
Open
xr843 wants to merge 1 commit intogarrytan:mainfrom
Open
fix: redact sensitive values in storage read command#168xr843 wants to merge 1 commit intogarrytan:mainfrom
xr843 wants to merge 1 commit intogarrytan:mainfrom
Conversation
Closes garrytan#18 (remaining part). The `storage` read command dumps all localStorage/sessionStorage values without redaction, potentially exposing tokens, API keys, and session data into stdout and model transcripts. Add redaction for values whose keys match sensitive patterns (token, secret, key, password, auth, credential, session). Key names are preserved so agents can see what's stored. A `--show-secrets` flag bypasses redaction when explicitly needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses #18 (remaining unfixed part).
Most of issue #18 was already fixed in prior commits:
cookie— redacts value as****header— redacts sensitive headerstype— returns only character countforms— redacts password field valuesstorage set— doesn't output the valueRemaining: The
storageread command dumps alllocalStorage/sessionStoragevalues without redaction viaJSON.stringify(storage, null, 2), potentially exposing tokens, API keys, and session data into stdout and model transcripts.Changes
browse/src/read-commands.ts--show-secretsflagRedacted patterns (case-insensitive):
token,secret,key,password,auth,credential,sessionKey names are preserved so agents can see what's stored without seeing the secret values. Example output:
{ "localStorage": { "theme": "dark", "authToken": "[redacted]", "api_key": "[redacted]" } }A
--show-secretsflag bypasses redaction when explicitly needed.Test plan
browse/test/commands.test.tspassgstack-configfailure confirmed onmain(not related)storagecommand redacts keys containing "token", "password", etc.storage --show-secretsshows full values🤖 Generated with Claude Code